@extends('admin.main')

@section('content')
<div class="wrapper wrapper-content">
  <div class="ibox">
    <div class="ibox-title">
      <h5>Meta设置</h5>
    </div>
    <div class="ibox-content">
      <form id="formSiteinfo" method="post" class="form-horizontal">
        <div class="form-group">
          <label class="col-sm-2 control-label">网站名称</label>
          <div class="col-sm-10">
            <input type="text" name="name" value="{{$meta['name']}}" class="form-control" required />
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">网站标题</label>
          <div class="col-sm-10">
            <input type="text" name="title" value="{{$meta['title']}}" class="form-control" required />
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">关 键 词</label>
          <div class="col-sm-10">
            <input type="text" name="keywords" value="{{$meta['keywords']}}" class="form-control" required />
            <span class="help-block m-b-none">多个关键词之间，请用“,”隔开</span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">网站描述</label>
          <div class="col-sm-10">
            <textarea id="ueditor_description" name="description">{{$meta['description']}}</textarea>
          </div>
        </div>
        <div class="hr-line-dashed"></div>
        <div class="form-group">
          <div class="col-sm-4 col-sm-offset-2">
            <button class="btn btn-success" type="submit"><i class="fa fa-save"></i> 保存配置</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
@endsection

@section('pagescript')
<script src="/assets/ueditor/ueditor.config.js"></script>
<script src="/assets/ueditor/ueditor.all.js"></script>
<script>
  $("#side-menu li[rel='siteconfig']").addClass("active")
    .find("ul").addClass("in")
    .find("li[rel='1']").addClass("active");

  var ueditor = UE.getEditor('ueditor_description');
  $("#formSiteinfo").on('submit', function(){
    var that = this;
    $(this).find(":submit").attr("disabled", "disabled");
    var url = "{{url('admin/siteconfig/set-meta')}}";
    $.post(url, $(this).serialize(), function(){
      $(that).find(":submit").removeAttr("disabled");
      artInfo('修改成功');
    }).fail(failure);
    return false;
  });
</script>
@endsection
